package com.zkthink.ceres.pay.wechat.v3.entity.result;

import com.zkthink.ceres.pay.wechat.v3.entity.request.*;
import com.zkthink.ceres.pay.wechat.v3.entity.request.combine.CloseOrderRequest;
import com.zkthink.ceres.pay.wechat.v3.entity.request.combine.CombineOrderRequest;
import com.zkthink.ceres.pay.wechat.v3.entity.request.combine.NoticeOrderRequest;
import com.zkthink.ceres.pay.wechat.v3.entity.request.combine.QueryOrderRequest;
import com.zkthink.ceres.pay.wechat.v3.entity.result.combine.*;

/**
 * <p>
 * 结果工厂
 * </p>
 *
 * @author vivi.huang
 * @since 2020/5/17
 */
public class ResultFactory {

    public static BasePayResult create(String content, BasePayRequest request) {
        if (request instanceof CombineOrderRequest) {
            return new CombineOrderResult(content);
        }

        if (request instanceof QueryOrderRequest) {
            return new QueryOrderResult(content);
        }

        if (request instanceof CloseOrderRequest) {
            return new CloseOrderResult(content);
        }

        if (request instanceof NoticeOrderRequest) {
            return new NoticeOrderResult(content);
        }
        return new DefaultPayResult(content);
    }
}